﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Xml;

namespace WeiboFilter.KeywordsRelated
{
    public class CiXing
    {
        private static Dictionary<string,int> _cxList;

        public static Dictionary<string,int> cxList
        {
            get { return _cxList; }
            private set { _cxList = value; }
        }

        /// <summary>
        /// 返回多少种词性被录入
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static int importConfigureXML(string filename)
        {
            cxList = new Dictionary<string, int>();
            XmlDocument doc = new XmlDocument();
            doc.Load(filename);
            XmlNodeList nodelist = doc.SelectNodes("FilterSystem/POSES/POS");
            foreach (XmlNode node in nodelist)
            {
                cxList.Add(node.SelectSingleNode("str").InnerText,Convert.ToInt32(node.SelectSingleNode("value").InnerText));
            }

            return cxList.Count;
        }
        
    }
}